'use strict';
//数据库相关
let mysql=require('mysql');
let db={};
db.make=function sqlBack(sqlLan,callback){
    let connection=mysql.createConnection({
        host:'localhost',
        user:'root',
        password:'jzl1112119',
        database:'singlin',
        port:'3306'
    });
    connection.connect(function (err) {
        if(err){
            console.log('sql',err);
            return;
        }
    });
    let sql=sqlLan;
    if(!sql) return;
    connection.query(sql,function (err,rows,filed) {
        if(err){
            console.log('sql',err);
            return;
        }
        callback(rows);
    });
    connection.end(function (err) {
        if(err){
            return;
        }
    });
};
module.exports=db;